package com.wyt.controller.empcollor;

import com.wyt.dao.LeftMapper;
import com.wyt.entity.Left;
import com.wyt.until.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: xiangmu01
 * @description: 离职员工操作
 * @author: 王一同
 * @create: 2021-11-25 10:33
 **/
@RestController
public class LeftempControllor {
    @Autowired
    private LeftMapper leftMapper;

    @RequestMapping("delLEmpById")
    public CommonResult delLEmpById(String lid){
        int i = leftMapper.deleteByLid(lid);
        CommonResult commonResult = new CommonResult();
        if(i>=1){
            commonResult.setCode(200);
            commonResult.setMsg("删除成功");
            return commonResult;
        }else{
            commonResult.setCode(500);
            commonResult.setMsg("删除失败");
            return commonResult;
        }
    }

    @RequestMapping("updateLEmp")
    public CommonResult updateLEmp(Integer lid,String lname,String lsex,String ltel,String ldepart,String loutdate){
        System.out.println(lid+lname+lsex+ltel+ ldepart+loutdate);
        int i = leftMapper.updateByLid(lid, lname, lsex, ltel, ldepart, loutdate);
        CommonResult commonResult = new CommonResult();
        if(i>=1){
            commonResult.setCode(200);
            commonResult.setMsg("修改成功");
            return commonResult;
        }else{
            commonResult.setCode(500);
            commonResult.setMsg("修改失败");
            return commonResult;
        }
    }
}
